import Vue from 'vue'
import VueRouter from 'vue-router'
import index from '../views/index.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: index
  }, {
    path: '/index',
    name: 'index',
    component: index
  }, {
    path: '/items',
    name: 'items',
    component: () => import("../views/shop/shop_items.vue"),
    props: route => ({
      id: route.query.id,
    })
  }, {
    path: '/like',
    name: 'like',
    component: () => import("../views/likes.vue")
  }, {
    path: '/shop/classifction',
    name: 'classifction',
    component: () => import("@/views/shop/shop_classifction.vue")
  }, {
    path: '/shop',
    name: 'items',
    component: () => import("../views/shop/shop_index.vue"),
    props: route => ({
      id: route.query.id,
    })
  }, {
    // 购物车页面
    path: '/shopcar',
    name: 'shopcar',
    component: () => import('../views/ShoppingCart.vue')
  },
  {
    // 购物车结算页面
    path: '/settlement',
    name: 'settlement',
    component: () => import('../views/settlement.vue')
  }, 
  // 购物车结算结果页面
  {
    path: '/setlrs',
    name: 'settlement',
    component: () => import('../views/settlement/settlement_result.vue')
  }, 
  {
    path: '/pscenter',
    name: 'pscenter',
    component: () => import("../views/pscenter.vue"),
    children: [
      {
        path: '/pscenter/userinfo',
        name: 'userinfo',
        component: () => import("@/components/pscenters/user_percenter.vue")
      }, {
        path: '/pscenter/orderlist',
        name: 'orderlist',
        component: () => import("@/components/pscenters/orderlist.vue")
      }, {
        path: '/pscenter/userdate',
        name: 'userdate',
        component: () => import("@/components/pscenters/user_date.vue")
      }, {
        path: '/pscenter/userbalance',
        name: 'userbalance',
        component: () => import("@/components/pscenters/user_balance.vue")
      },

    ]
  },
  {
    path: '/login',
    name: 'login',
    component: () => import("../views/login.vue")
  }, {
    path: '/business/admin',
    name: 'business_admin',
    component: () => import("../views/business/admin.vue")
  }, {
    path: '/regist',
    name: 'regist',
    component: () => import("../views/regist.vue")
  }, {
    path: '/operstores',
    name: 'operstores',
    component: () => import("../views/operstores.vue")
  }, {
    path: '/search/shop',
    name: 'search',
    component: () => import("../views/shop/shop_items_search.vue")
  },
  {
    path: '/index/customerService',
    name: 'customer_service',
    component: () => import("../views/customer_service/index_customer_service.vue"),
    children: [
      {
        path: 'mymsg',
        name: 'ervice',
        component: () => import("@/components/customer_service/myMsg.vue"),
      }, {
        path: 'systemmsg',
        name: 'ervice',
        component: () => import("@/components/customer_service/systemmsg.vue"),
      }, {
        // @我的
        path: 'mine',
        name: 'ervice',
        component: () => import("@/components/customer_service/mine.vue"),
      }, {
        // 回复我的
        path: 'replymsg',
        name: 'ervice',
        component: () => import("@/components/customer_service/replymsg.vue"),
      }, {
        // 收到的赞
        path: 'getassist',
        name: 'ervice',
        component: () => import("@/components/customer_service/getassist.vue"),
      }, {
        path: 'privatemsg',
        name: 'ervice',
        component: () => import("@/components/customer_service/privatemsg.vue"),
      }
    ]
  }, {
    path: "/notice",
    name: "notice",
    component: () => import("../views/notice.vue")
  }

]

const router = new VueRouter({
  routes
})

export default router
